Operators
The following operators can be used when assigning a value to a variable:
= |
assigns the right-hand expression to the left-hand variable (a = 3) |
+ |
adds two numbers or text strings (a + 3) |
- |
subtracts a number from another number (a - 3) |
* |
multiplies two numbers |
** |
power / involution / division |
/ |
division |
x++ |
increases the x variable by one |
x-- |
decreases the x variable by one |
x += 7 |
adds 7 to the value in x |
x -= 7 |
subtracts 7 from the value in x |
x *= 7 |
multiplies the value in x with 7 |
x /= 7 |
divides the value in x with 7 |
The following operators are primarily used for comparison in loops and conditional commands.
== |
equal |
<> |
not equal |
< |
less than |
> |
greater than |
<= |
less or equal |
>= |
greater or equal |
AND |
logical AND operator; TRUE if the two expressions are both TRUE, otherwise FALSE. It is possible to use && instead of AND |
OR |
logical OR operator; TRUE if either of the two expressions are TRUE, otherwise FALSE It is possible to use || instead of OR |
NOT |
logical NOT operator; reverses the result of a logical expression |